//
//  WBNetworkManager+Extension.swift
//  MyXinLangWeiBo
//
//  Created by 迟浩伦 on 2016/12/31.
//  Copyright © 2016年 迟浩伦. All rights reserved.
//

import Foundation
//封装新浪微博的网络请求方法
extension WBNetworkManager{
//记载微博数据字典数组   完成回调
    func statusList(completion: @escaping (_ list: [[String: Any?]]?,_ isSuccess: Bool)->()) {
        
        let urlString = "https://api.weibo.com/2/statuses/home_timeline.json"
        let params = ["access_token": "2.00P4firB2pxTHBce12ba51f6sqFw5B"]
       
        request(URLString: urlString, parameters: params) { (json, isSuccess) in
           
            //从json中获取statuses 字典数组
            let result = (json as AnyObject)["statuses"] as? [[String: Any]]
            
            completion(result, isSuccess)
        }

        
    }
}
